<template>
	<view class="content">
		<view class="p12">
			<view class="bg-white">
				<view class="u-flex u-f-jsb bm p12">
					<view>版本号</view>
					<view>V{{version}}</view>
				</view>
				<view class="u-flex u-f-jsb p12">
					<view>清除缓存</view>
					<view>{{mb}}M</view>
				</view>
			</view>
		</view>
		<view class="fixed-bottom">
			<view class="btn" @click="toLogout">退出登录</view>
		</view>
	</view>
</template>

<script>
	import {
		getPlatform
	} from '@/config/util.js'
	export default {
		data() {
			return {
				version:'',
				mb:''
			};
		},
		methods: {
			 getVersion() {
			      // 判断是否在HTML5+环境中运行
			      if (uni.getSystemInfoSync().platform === 'android' || uni.getSystemInfoSync().platform === 'ios') {
			        plus.runtime.getProperty(plus.runtime.appid, (inf) => {
			          this.version = inf.version;
			        });
			      } else {
			        // 非HTML5+环境中的处理逻辑
			        console.log('非HTML5+环境，无法获取版本号');
			      }
			    },
				toLogout() {
			
					this.$common.modelShow('提示', '确认退出登录吗?', () => {
						
							uni.showToast({
								title: '退出成功',
								icon: 'none'
							});
							setTimeout(() => {
									
								this.$db.clear()
								uni.reLaunch({
									url: '/pages/index/index'
								})
							}, 1500)
					});
			
				},
		},
		onLoad: function() {
			
			const storageInfo = uni.getStorageInfoSync();
			this.mb=(storageInfo.currentSize/1024/1024).toFixed(0)
			this.getVersion()
		}
	};
</script>

<style lang="scss">

	.btn {
		background: rgba(242,70,70,0.1);
		color: #F24646;
	}
	
</style>